<template>
  <view class="layout">
    <view class="title-bar">
      <view class="left-title">
        <view class="flag" />
        <wd-text text="今日概览" color="#000000" size="18px" />
      </view>
      <view class="right-title">
        <view class="right-title-item"> 课间锻炼 </view>
        <view v-if="isParticipated" class="right-title-participated">
          √ 已参与
        </view>
        <view v-else class="right-title-not-participated"> X 未参与 </view>
        <!-- <wd-text text="课间锻炼" color="#000000" size="12px" />
        <wd-text text="√ 已参与" color="#14C900" size="12px" />
        <wd-text text="√ 已参与" color="#14C900" size="12px" /> -->
      </view>
    </view>
    <view>
      <view class="today-overview">
        <view class="item">
          <view class="item-value">
            {{
              overViewInfo.scoreValue > 0
                ? `+${overViewInfo.scoreValue}`
                : overViewInfo.scoreValue
            }}
          </view>
          <view class="item-title"> 成长值 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.sportTime }}
          </view>
          <view class="item-title"> 运动总次数 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.classLevel }}
          </view>
          <view class="item-title"> 班级排名 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.gradeLevel }}
          </view>
          <view class="item-title"> 年级排名 </view>
        </view>
      </view>
      <view v-if="isParticipated" class="sport-overview">
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.scoreForDeepSquat }}
          </view>
          <view class="item-title"> 深蹲 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.scoreForJump }}
          </view>
          <view class="item-title"> 跳绳 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.scoreForJumpLong }}
          </view>
          <view class="item-title"> 立定跳远 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.scoreForBasketball }}
          </view>
          <view class="item-title"> 篮球拍球 </view>
        </view>
        <view class="item">
          <view class="item-value">
            {{ overViewInfo.scoreForVolleyball }}
          </view>
          <view class="item-title"> 排球垫球 </view>
        </view>
      </view>
      <view v-else class="no-data"> 暂无运动数据 </view>
    </view>
  </view>
</template>

<script lang="ts" setup>
const isParticipated = ref(true);
const overViewInfo = reactive<{
  scoreValue: number; // 成长值
  sportTime: number; // 运动总次数
  classLevel: number; // 班级排名
  gradeLevel: number; // 年级排名
  scoreForDeepSquat: number; // 深蹲
  scoreForJump: number; // 跳绳
  scoreForJumpLong: number; // 立定跳远
  scoreForBasketball: number; // 篮球拍球
  scoreForVolleyball: number; // 排球垫球
}>({
  scoreValue: 0,
  sportTime: 0,
  classLevel: 0,
  gradeLevel: 0,
  scoreForDeepSquat: 0,
  scoreForJumpLong: 0,
  scoreForJump: 0,
  scoreForBasketball: 0,
  scoreForVolleyball: 0,
});
</script>

<style lang="scss" scoped>
.layout {
  margin: 20px 0;
  border-radius: 10px;
  background: #ffffff;
  padding: 10px;
  width: calc(100% - 20px);
}
.title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flag {
  width: 2px;
  height: 11px;
  background: #095aeb;
  margin-right: 10px;
}
.left-title {
  display: flex;
  align-items: center;
}
.right-title {
  display: flex;
  align-items: center;
  flex-direction: column;
  .right-title-item {
    font-weight: normal;
    line-height: 12px;
    text-align: center;
    letter-spacing: 0.005em;
    color: #000000;
    margin-bottom: 5px;
  }
  .right-title-participated {
    font-weight: normal;
    line-height: 12px;
    text-align: center;
    letter-spacing: 0.005em;
    color: #14c900;
  }
  .right-title-not-participated {
    font-weight: normal;
    line-height: 12px;
    text-align: center;
    letter-spacing: 0.005em;
    color: #ff2d2d;
  }
}
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 25%;
  height: 74px;
}
.item-value {
  display: flex;
  width: 100%;
  font-size: 20px;
  color: #000000;
  justify-content: center;
}
.item-title {
  display: flex;
  width: 100%;
  font-size: 12px;
  color: #000000;
  justify-content: center;
}
.today-overview {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 74px;
}
.sport-overview {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 128px;
}
.no-data {
  height: 140px;
  font-size: 12px;
  font-weight: normal;
  line-height: 140px;
  text-align: center;
  letter-spacing: 0.005em;
  color: #666666;
}
</style>
